﻿using DotNetty.Buffers;
using QQ.Codecs;
using System.Collections.Generic;

namespace QQ.Packet
{
    public class wtlogin_login : Request.IRequest, Response.IResponse
    {
        public short subCommand { get; set; } = 9;
        public byte loginRet { get; set; }//just response have
        public Dictionary<short, IByteBuffer> tlvs { get; set; }

        public void Deserialize(IByteBuffer buffer)
        {
            subCommand = buffer.ReadShort();
            loginRet = buffer.ReadByte();
            tlvs = buffer.ReadTLVS();
        }

        public IByteBuffer Serialize() => Unpooled.Buffer()
                .WriteShort(subCommand)
                .WriteTLVS(tlvs);
    }
}
